package com.example.demo.spring;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

/**
 * @author wangsl
 * @date 2020/7/5 23:10
 * <p>
 * Description:
 */
@Service
//@Service一般用于业务逻辑层,注入bean
public class UserService {

    @Autowired
    @Qualifier("createUserDao")//当有容器中有多个同一个类的bean实例时,装配指定的bean实例
    private UserDao userDao;

    @Override
    public String toString() {
        return "UserService{" +
                "userDao=" + userDao +
                '}';
    }

   /* public UserDao getUserDao() {
        return userDao;
    }
    //Autowired注入不需要set方法
    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }*/
}
